package com.dews.course.service.impl;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dews.common.core.domain.model.LoginUser;
import com.dews.common.utils.EmailUtils;
import com.dews.common.utils.PaginateListUtil;
import com.dews.common.utils.SecurityUtils;
import com.dews.course.convert.DegreeGradeConvert;
import com.dews.course.domain.entity.DegreeGrade;
import com.dews.course.domain.entity.StudentScore;
import com.dews.course.domain.ro.DegreeGradeRo;
import com.dews.course.domain.ro.LinearRegressionModelRo;
import com.dews.course.domain.vo.DegreeGradeVo;
import com.dews.course.enums.SemesterEnum;
import com.dews.course.mapper.DegreeGradeMapper;
import com.dews.course.mapper.StudentScoreMapper;
import com.dews.course.service.IDegreeGradeService;
import com.dews.course.utils.PredictRemainingUtil;
import com.dews.information.domain.entity.StudentInfo;
import com.dews.information.domain.entity.SubjectCourse;
import com.dews.information.enums.StateSchoolEnum;
import com.dews.information.mapper.StudentInfoMapper;
import com.dews.information.mapper.SubjectCourseMapper;
import com.dews.train.domain.entity.ProgramTeachPlan;
import com.dews.train.domain.entity.TrainingProgram;
import com.dews.train.enums.StudyRequireEnum;
import com.dews.train.mapper.ProgramTeachPlanMapper;
import com.dews.train.mapper.TrainingProgramMapper;
import com.dews.warn.domain.entity.NotificationMessage;
import com.dews.warn.enums.MessageTypeEnum;
import com.dews.warn.mapper.NotificationMessageMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;

/**
 * 学业成绩成绩统计Service业务层处理
 *
 * @author qingfeng
 * @date 2025-02-03
 */
@Service
public class DegreeGradeServiceImpl extends ServiceImpl<DegreeGradeMapper, DegreeGrade> implements IDegreeGradeService {

    private DegreeGradeMapper degreeGradeMapper;
    private StudentScoreMapper studentScoreMapper;
    private StudentInfoMapper studentInfoMapper;
    private TrainingProgramMapper trainingProgramMapper;
    private ProgramTeachPlanMapper programTeachPlanMapper;
    private EmailUtils emailUtils;
    private NotificationMessageMapper notificationMessageMapper;
    private SubjectCourseMapper subjectCourseMapper;

    @Autowired
    public DegreeGradeServiceImpl(DegreeGradeMapper degreeGradeMapper,
                                  StudentScoreMapper studentScoreMapper,
                                  StudentInfoMapper studentInfoMapper,
                                  TrainingProgramMapper trainingProgramMapper,
                                  ProgramTeachPlanMapper programTeachPlanMapper,
                                  EmailUtils emailUtils,
                                  NotificationMessageMapper notificationMessageMapper,
                                  SubjectCourseMapper subjectCourseMapper) {
        this.degreeGradeMapper = degreeGradeMapper;
        this.studentScoreMapper = studentScoreMapper;
        this.studentInfoMapper = studentInfoMapper;
        this.trainingProgramMapper = trainingProgramMapper;
        this.programTeachPlanMapper = programTeachPlanMapper;
        this.emailUtils = emailUtils;
        this.notificationMessageMapper = notificationMessageMapper;
        this.subjectCourseMapper = subjectCourseMapper;
    }


    /**
     * 每日统计学生的学分绩点信息
     */
    @Override
    public void statisticsDegreeGrade() {
        // 先每日更新全部，分页并发统计
        Long count = studentScoreMapper.selectCount(null);
        if (count > 0) {
            Integer pageSize = 100;
            Integer pageCount = (int) Math.ceil((double) count / pageSize);

            // 使用CompletableFuture进行并发处理
            List<DegreeGrade> collect = IntStream.range(1, pageCount + 1)
                    .mapToObj(page -> CompletableFuture.supplyAsync(() -> {
                        Page<StudentScore> studentScorePage = studentScoreMapper.selectPage(
                                new Page<>(page, pageSize),
                                null
                        );
                        if (CollUtil.isNotEmpty(studentScorePage.getRecords())) {
                            return studentScorePage.getRecords()
                                    .stream()
                                    .collect(Collectors.groupingBy(StudentScore::getUserId))
                                    .entrySet()
                                    .stream()
                                    .map(e -> {
                                        // 统计每个学分
                                        return DegreeGrade.builder()
                                                .userId(e.getKey())
                                                .compulsoryCredits(
                                                        e.getValue()
                                                                .stream()
                                                                .filter(studentScore -> StudyRequireEnum.COMPULSORY.getCode().equals(studentScore.getStudyRequire()))
                                                                .mapToDouble(StudentScore::getCredits)
                                                                .sum()
                                                )
                                                .electiveCredits(
                                                        e.getValue()
                                                                .stream()
                                                                .filter(studentScore -> StudyRequireEnum.SELECT_EMBELLISH.getCode().equals(studentScore.getStudyRequire()))
                                                                .mapToDouble(StudentScore::getCredits)
                                                                .sum()
                                                )
                                                .gradePoint(
                                                        e.getValue()
                                                                .stream()
                                                                .map(StudentScore::getGradePoint)
                                                                .filter(ObjectUtil::isNotNull)
                                                                .mapToDouble(Double::doubleValue)
                                                                .sum()
                                                )
                                                .academicScore(
                                                        e.getValue()
                                                                .stream()
                                                                .map(s -> s.getCredits() * s.getGradePoint())
                                                                .filter(ObjectUtil::isNotNull)
                                                                .mapToDouble(Double::doubleValue)
                                                                .sum()
                                                )
                                                .build();
                                    })
                                    .collect(Collectors.toList());
                        } else {
                            return null;
                        }
                    }))
                    .toList()
                    .stream()
                    .map(CompletableFuture::join)
                    .filter(Objects::nonNull)
                    .flatMap(List::stream)
                    .collect(Collectors.groupingBy(DegreeGrade::getUserId))
                    .entrySet()
                    .stream()
                    .map(e -> DegreeGrade.builder()
                            .userId(e.getKey())
                            .compulsoryCredits(
                                    e.getValue()
                                            .stream()
                                            .map(DegreeGrade::getCompulsoryCredits)
                                            .filter(ObjectUtil::isNotNull)
                                            .mapToDouble(Double::doubleValue)
                                            .sum()
                            )
                            .electiveCredits(
                                    e.getValue()
                                            .stream()
                                            .map(DegreeGrade::getElectiveCredits)
                                            .filter(ObjectUtil::isNotNull)
                                            .mapToDouble(Double::doubleValue)
                                            .sum()
                            )
                            .gradePoint(
                                    e.getValue()
                                            .stream()
                                            .map(DegreeGrade::getGradePoint)
                                            .filter(ObjectUtil::isNotNull)
                                            .mapToDouble(Double::doubleValue)
                                            .sum()
                            )
                            .academicScore(
                                    e.getValue()
                                            .stream()
                                            .map(DegreeGrade::getAcademicScore)
                                            .filter(ObjectUtil::isNotNull)
                                            .mapToDouble(Double::doubleValue)
                                            .sum()
                            )
                            .build()
                    )
                    .toList();

            // 分页处理
            new PaginateListUtil<DegreeGrade>()
                    .paginateList(collect, 500)
                    .forEach(list -> {
                        Map<Long, Integer> degreeGradeMap = degreeGradeMapper.selectList(
                                        Wrappers.lambdaQuery(DegreeGrade.class)
                                                .in(DegreeGrade::getUserId, list.stream().map(DegreeGrade::getUserId).collect(Collectors.toSet()))
                                ).stream()
                                .collect(Collectors.toMap(
                                        DegreeGrade::getUserId,
                                        DegreeGrade::getId
                                ));

                        list.forEach(degreeGrade -> degreeGrade.setId(degreeGradeMap.getOrDefault(degreeGrade.getUserId(), null)));
                        this.saveOrUpdateBatch(list);
                    });
        }

    }

    /**
     * 学位预警
     */
    @Override
    public void degreeWarning() {
        // 统计在校学生, 分页处理
        Long count = studentInfoMapper.selectCount(
                Wrappers.lambdaQuery(StudentInfo.class)
                        .eq(StudentInfo::getStateSchool, StateSchoolEnum.AT_SCHOOL.name())
        );
        if (count > 0) {
            Integer pageSize = 500;
            Integer pageCount = (int) Math.ceil((double) count / pageSize);

            // 先封装修复方案和教学计划
            // 封装修读方案计划
            List<TrainingProgram> trainingProgramList = trainingProgramMapper.selectList(
                    Wrappers.lambdaQuery(TrainingProgram.class)
                            .eq(TrainingProgram::getIsEnable, 1)
            );
            Map<String, TrainingProgram> trainingProgramMap = trainingProgramList.stream()
                    .collect(Collectors.toMap(
                            t -> t.getDepId().toString() + t.getSubjectId() + t.getGrade(),
                            Function.identity()
                    ));
            Map<String, List<ProgramTeachPlan>> teachPlanMap;
            if (CollUtil.isNotEmpty(trainingProgramList)) {
                Map<Integer, List<ProgramTeachPlan>> programTeachPlanMap = programTeachPlanMapper.selectList(
                                Wrappers.lambdaQuery(ProgramTeachPlan.class)
                                        .in(ProgramTeachPlan::getProgramId, trainingProgramList.stream().map(TrainingProgram::getId).collect(Collectors.toSet()))
                        ).stream()
                        .collect(Collectors.groupingBy(ProgramTeachPlan::getProgramId));

                teachPlanMap = trainingProgramList.stream()
                        .collect(Collectors.toMap(
                                t -> t.getDepId().toString() + t.getSubjectId() + t.getGrade(),
                                t -> programTeachPlanMap.get(t.getId())
                        ));
            } else {
                teachPlanMap = Collections.emptyMap();
            }

            // 年级+专业  分组   每个年级专业的修读方案是固定的
            IntStream.range(1, pageCount + 1).mapToObj(page -> studentInfoMapper.selectPage(
                    new Page<>(page, pageSize),
                    Wrappers.lambdaQuery(StudentInfo.class)
                            .eq(StudentInfo::getStateSchool, StateSchoolEnum.AT_SCHOOL.name())
            )).forEach(studentInfoPage -> studentInfoPage.getRecords()
                    .forEach(s -> {
                        // 循环处理每一个学生的成绩信息
                        List<StudentScore> studentScoreList = studentScoreMapper.selectList(Wrappers.lambdaQuery(StudentScore.class).eq(StudentScore::getUserId, s.getUserId()));
                        if (CollUtil.isNotEmpty(studentScoreList)) {
                            // 学分预警
                            creditWarning(s, teachPlanMap, trainingProgramMap, studentScoreList);
                            // 学分绩点预警
                            gradePointWarning(s, teachPlanMap, trainingProgramMap, studentScoreList);
                            // 毕业达成预警
                            graduateWarning(s, teachPlanMap, trainingProgramMap, studentScoreList);
                        }

                    }));
        }
    }

    @Override
    public DegreeGradeRo getUserDegreeGrade() {
        LoginUser loginUser = SecurityUtils.getLoginUser();
        StudentInfo studentInfo = studentInfoMapper.selectOne(
                Wrappers.lambdaQuery(StudentInfo.class)
                        .eq(StudentInfo::getUserId, loginUser.getUserId())
        );
        DegreeGrade degreeGrade = this.getOne(
                Wrappers.lambdaQuery(DegreeGrade.class)
                        .eq(DegreeGrade::getUserId, SecurityUtils.getUserId())
        );

        // 查询学生所属的人才培养方案
        TrainingProgram trainingProgram = trainingProgramMapper.selectOne(
                Wrappers.lambdaQuery(TrainingProgram.class)
                        .eq(TrainingProgram::getDepId, studentInfo.getDepId())
                        .eq(TrainingProgram::getSubjectId, studentInfo.getSubjectId())
                        .eq(TrainingProgram::getGrade, studentInfo.getGrade())
                        .eq(TrainingProgram::getIsEnable, 1)
        );

        return DegreeGradeRo.builder()
                .degreeGrade(degreeGrade)
                .trainingProgram(trainingProgram)
                .build();
    }

    /**
     * 学分预警
     * <p>
     * 统计每一个学期的应得学分是否已经完成，如果未完成则预警通知
     */
    private void creditWarning(StudentInfo s,
                               Map<String, List<ProgramTeachPlan>> teachPlanMap,
                               Map<String, TrainingProgram> trainingProgramMap,
                               List<StudentScore> studentScoreList) {
        // 如果没有成绩信息，直接不处理   TODO  需要考虑入学时间，年级， 学制, 已完成的需要排除
        // 学分按学期分组求总学分，并按学期排序
        Map<String, Double> creditsMap = studentScoreList.stream()
                .collect(Collectors.groupingBy(
                        StudentScore::getSemester,
                        Collectors.summingDouble(StudentScore::getCredits)
                ));

        // 按学制判断学期数
        List<SemesterEnum> semesterEnumList = SemesterEnum.getSemesterEnumList(s.getEducationalSystem());

        // 统计教学计划中，每个学期的总学分
        List<ProgramTeachPlan> programTeachPlanList = teachPlanMap.get(s.getDepId().toString() + s.getSubjectId() + s.getGrade());
        Map<Integer, Double> groupedBySemesterMap = programTeachPlanList.stream()
                .flatMap(plan -> plan.getSemester().stream()
                        .map(semester -> new AbstractMap.SimpleEntry<>(semester, plan.getCredit())))
                .collect(Collectors.groupingBy(
                        AbstractMap.SimpleEntry::getKey,
                        Collectors.summingDouble(Map.Entry::getValue)
                ));
        // 每个学期已获得的学分
        Map<Integer, Double> integerDoubleMap = getIntegerDoubleMap(semesterEnumList, creditsMap, groupedBySemesterMap);

        // 计算最终的结果是否满足教学计划要求的总学分
        double totalScore = Stream.concat(
                        creditsMap.values().stream(),
                        integerDoubleMap.values().stream()
                )
                .mapToDouble(Double::doubleValue)
                .sum();

        // 直接判断是能满足预期的学分
        TrainingProgram trainingProgram = trainingProgramMap.get(s.getDepId().toString() + s.getSubjectId() + s.getGrade());
        Optional.ofNullable(trainingProgram)
                .ifPresent(t -> {
                    // TODO 进行预警  发送邮件消息, 邮箱存在 ，发送消息人可能比较多（MQ）
                    if (totalScore < t.getTotalCreditsGraduation().doubleValue()) {
                        // 存储消息通知
                        NotificationMessage notificationMessage = NotificationMessage.builder()
                                .sendUserId(-1L)
                                .receiveUserId(s.getUserId())
                                .messageType(MessageTypeEnum.CREDIT_WARNING.getCode())
                                .messageTitle(MessageTypeEnum.CREDIT_WARNING.getMessage())
                                .content(
                                        String.format("【%s同学你好】" +
                                                        "你当前已修学分：%s分。" +
                                                        "人才培养方案要求的学分是： %s分。" +
                                                        "预计在毕业时无法达成人才培养方案上指定的学分，请提前查漏，避免影响毕业",
                                                s.getStudentName(),
                                                creditsMap.values().stream().mapToDouble(Double::doubleValue).sum(),
                                                t.getTotalCreditsGraduation().doubleValue()
                                        )
                                )
                                .build();
                        // TODO 学生人数多的情况下，需要使用MQ
                        notificationMessageMapper.insert(notificationMessage);
                    }
                });

    }


    /**
     * 学分绩点预警   学分*绩点 = 学分绩点
     * 计算每一个学期的学分绩点总和，使用线性回归预测模型进行预测，预警
     */
    private void gradePointWarning(StudentInfo s,
                                   Map<String, List<ProgramTeachPlan>> teachPlanMap,
                                   Map<String, TrainingProgram> trainingProgramMap,
                                   List<StudentScore> studentScoreList) {
        // 1. 计算每学期所有课程的学分绩点总和
        Map<String, Double> creditsGradePointMap = studentScoreList.stream()
                .collect(Collectors.groupingBy(
                        StudentScore::getSemester,
                        Collectors.summingDouble(stu -> stu.getCredits() * stu.getGradePoint())
                ));

        // 按学制判断学期数
        List<SemesterEnum> semesterEnumList = SemesterEnum.getSemesterEnumList(s.getEducationalSystem());
        // 2. 统计每学期应得的学分绩点总和
        List<ProgramTeachPlan> programTeachPlanList = teachPlanMap.get(s.getDepId().toString() + s.getSubjectId() + s.getGrade());
        Map<Integer, Double> groupedBySemesterMap = programTeachPlanList.stream()
                .flatMap(plan -> plan.getSemester().stream()
                        .map(semester -> new AbstractMap.SimpleEntry<>(semester, plan.getCredit() * 5)))
                .collect(Collectors.groupingBy(
                        AbstractMap.SimpleEntry::getKey,
                        Collectors.summingDouble(Map.Entry::getValue)
                ));

        // 3.  进行预测预警
        Map<Integer, Double> integerDoubleMap = getIntegerDoubleMap(semesterEnumList, creditsGradePointMap, groupedBySemesterMap);
        // 计算最终的结果是否满足教学计划要求的总学分
        double totalScore = Stream.concat(
                        creditsGradePointMap.values().stream(),
                        integerDoubleMap.values().stream()
                )
                .mapToDouble(Double::doubleValue)
                .sum();
        // 直接判断是能满足预期的学分
        TrainingProgram trainingProgram = trainingProgramMap.get(s.getDepId().toString() + s.getSubjectId() + s.getGrade());
        Optional.ofNullable(trainingProgram)
                .ifPresent(t -> {
                    // TODO 进行预警  发送邮件消息, 邮箱存在，发送消息人可能比较多（MQ）
                    if (totalScore < t.getTotalAcademicPerformanceScore().doubleValue()) {
                        // 存储消息通知
                        NotificationMessage notificationMessage = NotificationMessage.builder()
                                .sendUserId(-1L)
                                .receiveUserId(s.getUserId())
                                .messageType(MessageTypeEnum.GRADE_POINT_WARNING.getCode())
                                .messageTitle(MessageTypeEnum.GRADE_POINT_WARNING.getMessage())
                                .content(
                                        String.format("【%s同学你好】" +
                                                        "你当前已获得的总学分绩点是：%s。" +
                                                        "人才培养方案要求的学分绩点是： %s。" +
                                                        "预计在毕业时无法达成人才培养方案上指定的学分绩点，请提前查漏，避免影响毕业",
                                                s.getStudentName(),
                                                creditsGradePointMap.values().stream().mapToDouble(Double::doubleValue).sum(),
                                                t.getTotalAcademicPerformanceScore().doubleValue()
                                        )
                                )
                                .build();
                        // TODO 学生人数多的情况下，需要使用MQ
                        notificationMessageMapper.insert(notificationMessage);
                    }
                });

    }

    /**
     * 使用线性回归算法进行值预测
     *
     * @param semesterEnumList
     * @param creditsGradePointMap
     * @param groupedBySemesterMap
     * @return
     */
    private static Map<Integer, Double> getIntegerDoubleMap(List<SemesterEnum> semesterEnumList, Map<String, Double> creditsGradePointMap, Map<Integer, Double> groupedBySemesterMap) {
        List<Double> earnedCreditsPerSemester = new ArrayList<>();
        // 每个学期可以拿到的学分
        List<Double> totalCreditsPerSemester = new ArrayList<>();
        semesterEnumList.stream()
                .sorted()
                .forEach(semesterEnum -> {
                    if (creditsGradePointMap.containsKey(semesterEnum.getSemester())) {
                        earnedCreditsPerSemester.add(creditsGradePointMap.get(semesterEnum.getSemester()));
                    }
                    if (groupedBySemesterMap.containsKey(semesterEnum.getSemesterId())) {
                        totalCreditsPerSemester.add(groupedBySemesterMap.get(semesterEnum.getSemesterId()));
                    }
                });
        // 封装预测数据
        Map<Integer, Double> integerDoubleMap = PredictRemainingUtil.predictRemainingCredits(
                LinearRegressionModelRo.builder()
                        .earnedCreditsPerSemester(earnedCreditsPerSemester)
                        .totalCreditsPerSemester(totalCreditsPerSemester)
                        .totalSemesters(4)
                        .build()
        );
        return integerDoubleMap;
    }

    /**
     * 毕业达成预警
     * <p>
     * 未完成的课程，挂科预警
     *      TODO  和培养方案上指定的课程进行一一比较
     * <p>
     * 课外成绩是否完成
     */
    private void graduateWarning(StudentInfo s,
                                 Map<String, List<ProgramTeachPlan>> teachPlanMap,
                                 Map<String, TrainingProgram> trainingProgramMap,
                                 List<StudentScore> studentScoreList) {
        Set<Integer> courseIdSet = teachPlanMap.values()
                .stream()
                .flatMap(Collection::stream)
                .map(ProgramTeachPlan::getCourseId)
                .collect(Collectors.toSet());
        Map<Integer, SubjectCourse> subjectCourseMap = subjectCourseMapper.selectBatchIds(courseIdSet)
                .stream()
                .collect(Collectors.toMap(
                        SubjectCourse::getId,
                        Function.identity()
                ));
        // 1. 统计是否有挂科的课程，有直接进行预警
        studentScoreList.stream()
                .collect(Collectors.groupingBy(StudentScore::getSubjectId))
                .entrySet()
                .stream()
                .filter(e -> e.getValue().stream().allMatch(s1 -> ObjectUtil.isNull(s1.getScore()) || s1.getScore() < 60))
                .forEach(e -> {
                    // TODO 进行预警  发送邮件消息, 邮箱存在，发送消息人可能比较多（MQ）
                    NotificationMessage notificationMessage = NotificationMessage.builder()
                            .sendUserId(-1L)
                            .receiveUserId(s.getUserId())
                            .messageType(MessageTypeEnum.GRADE_POINT_WARNING.getCode())
                            .messageTitle(MessageTypeEnum.GRADE_POINT_WARNING.getMessage())
                            .content(
                                    String.format("【%s同学你好】" +
                                                    "你当前已存在挂科课程尚未完成， 课程如下：%s。" +
                                                    "为了不影响毕业，请尽快重修并完成 挂科科目",
                                            s.getStudentName(),
                                            e.getValue().stream().map(c -> subjectCourseMap.get(c.getSubjectCourseId()).getCourseName()).collect(Collectors.joining(","))
                                    )
                            )
                            .build();
                    // TODO 学生人数多的情况下，需要使用MQ
                    notificationMessageMapper.insert(notificationMessage);
                });

        // TODO 2. 统计已完成的学期中，是否有未休的课程，有的话需要预警


        // TODO 3. 最后一学期，统计所有指标是能完成
    }


    /**
     * 查询学业成绩成绩统计列表
     *
     * @param degreeGradeVo 学业成绩成绩统计
     * @return 学业成绩成绩统计
     */
    @Override
    public List<DegreeGradeVo> selectDegreeGradeList(DegreeGradeVo degreeGradeVo) {
        return Collections.emptyList();
    }


    /**
     * 查询学业成绩成绩统计
     *
     * @param id 学业成绩成绩统计主键
     * @return 学业成绩成绩统计
     */
    @Override
    public DegreeGradeVo selectDegreeGradeById(Integer id) {
        return null;
    }

    /**
     * 新增学业成绩成绩统计
     *
     * @param degreeGradeVo 学业成绩成绩统计
     * @return 结果
     */
    @Override
    public int insertDegreeGrade(DegreeGradeVo degreeGradeVo) {
        DegreeGrade degreeGrade = DegreeGradeConvert.INSTANCE.convert(degreeGradeVo);


        return degreeGradeMapper.insert(degreeGrade);

    }

    /**
     * 修改学业成绩成绩统计
     *
     * @param degreeGradeVo 学业成绩成绩统计
     * @return 结果
     */
    @Override
    public int updateDegreeGrade(DegreeGradeVo degreeGradeVo) {
        DegreeGrade degreeGrade = DegreeGradeConvert.INSTANCE.convert(degreeGradeVo);
        return degreeGradeMapper.updateById(degreeGrade);
    }

    /**
     * 批量删除学业成绩成绩统计
     *
     * @param ids 需要删除的学业成绩成绩统计主键
     * @return 结果
     */
    @Override
    public int deleteDegreeGradeByIds(List<Integer> ids) {
        return degreeGradeMapper.deleteBatchIds(ids);
    }

    /**
     * 删除学业成绩成绩统计信息
     *
     * @param id 学业成绩成绩统计主键
     * @return 结果
     */
    @Override
    public int deleteDegreeGradeById(Integer id) {
        return degreeGradeMapper.deleteById(id);
    }

}
